/**ai出牌 */
var _ = require('../../../FrameWork/we_underscore');
var FindSameCardValueTool = require('../../FindTool/FindSameCardValueTool');
var EumPkGroup = require('../../Enum/EumPkGroup');
var AIGetBomb = module.exports = {};

// AIGetBomb.doMore = function(_lastCardInfo, _cardsInfo) {
//     var resultMore = {
//         isFind: false,
//         allGetCardsGroup: []
//     };
//     var result = this.do(_lastCardInfo, _cardsInfo);
//     if (result.isFind) {

//     }
//     return resultMore;
// };
/***AI出牌
 * _cardsInfo:[{}];
 */
AIGetBomb.do = function(_lastCardInfo, _cardsInfo) {
    var cardCnt = _.size(_cardsInfo);
    if (cardCnt < 4) {
        return {
            isFind: false
        };
    }
    var sameCardsList = FindSameCardValueTool.check(_cardsInfo);
    sameCardsList = _.filter(sameCardsList, function(_cards) {
        return 4 == _.size(_cards);
    });
    if (_.size(sameCardsList) > 0) {
        var recommendCards = sameCardsList[0];
        //计算带的那张牌
        return {
            isFind: true,
            type: EumPkGroup.BOMB,
            recommendCards: recommendCards, //推荐组
            allGetCardsGroup: sameCardsList //所有组 
        };
    }
    return {
        isFind: false
    };
};